package com.ecoolex.discount.sales.enums;

import com.ecoolex.discount.sales.entity.DiscountOrder;
import com.ecoolex.framework.common.EnumInterface;
import com.ecoolex.framework.common.util.Check;

public enum DiscountOrderCompleteStatus implements EnumInterface<DiscountOrderCompleteStatus, Integer> {
	UNKNOWN(0, "未知"),
	PART_COMPLETED(51, "部分完成"),
	COMPLETED(52, "全部完成"),
	;

	private int real;

	private String describe;

	private DiscountOrderCompleteStatus(int real, String describe) {
		this.real = real;
		this.describe = describe;
	}

	@Override
	public Integer real() {
		return real;
	}

	@Override
	public String describe() {
		return describe;
	}

	public static DiscountOrderCompleteStatus realValueOf(Integer real) {
		if (Check.notNull(real)) {
			for (DiscountOrderCompleteStatus v : values()) {
				if (v.real().equals(real)) {
					return v;
				}
			}
		}
		return null;
	}
	
	public static boolean canConfirmComplete(DiscountOrder order) {
		return PART_COMPLETED.equal(order.getCompleteStatus());
	}
	
	public static boolean canPartConfirmComplete(DiscountOrder order) {
		return UNKNOWN.equal(order.getCompleteStatus());
	}
}
